<template>
	<view class="shopList">
		<view class="shopListItem" v-for="(item, index) in product" :key="index">
			<navigator hover-class="none" :url="'../detail/detail?id='+item.id">
				<image :src="imgUrl + item.mainimage" class="shopImg" mode=""></image>
				<view class="shopTitle">
					{{item.smalltitle}}
				</view>
				<view class="shopActive">
					<view class="shopActiveLab" v-if="item.tag == 1">
						新品
					</view>
					<view class="shopActiveLab" v-if="item.tag == 2">
						热销
					</view>
					<view class="shopActiveLab" v-if="item.tag == 3">
						促销
					</view>
					<view class="shopActiveTxt">
						{{item.summary}}
					</view>
				</view>
				<view class="shopPrice">
					￥{{item.price}}
				</view>
			</navigator>
		</view>
	</view>
</template>

<script>
	export default {
		props:{
			product:{
				type:Array,
				default(){
					return []
				}
			}
		},
		data(){
			return{
				imgUrl:this.$imgUrl
			}
		}
	}
</script>

<style>
	.shopList{
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
	}
	.shopListItem{
		width: 370rpx;
		height: 540rpx;
		background: #fff;
		overflow: hidden;
		margin-top: 10rpx;
	}
	.shopListItem .shopImg{
		height: 316rpx;
		width: 316rpx;
		display: block;
		margin: 40rpx auto 0; // 这里子元素加margin-top会引起高度塌陷问题 解决让父级加overflow:hidden
	}
	.shopListItem .shopTitle{
		height: 50rpx;
		line-height: 50rpx;
		font-size: 28rpx;
		text-align: center;
	}
	.shopListItem .shopActive{
		height: 40rpx;
		width: 346rpx;
		margin: 0 auto;
		border: 1rpx solid #d9000b;
		display: flex;
	}
	.shopActiveLab{
		width: 70rpx;
		background: #d9000b;
		font-size: 24rpx;
		color: #fff;
		text-align: center;
		line-height: 40rpx;
	}
	.shopActiveTxt{
		width: 276rpx;
		font-size: 24rpx;
		color: #d9000b;
		/* text-align: center; */
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		line-height: 40rpx;
	}
	.shopPrice{
		font-size: 28rpx;
		color: #d9000b;
		text-align: center;
		line-height: 80rpx;
	}
</style>
